import request from '@/utils/request'

export function getLabelCustomData() {
  return request({
    url: `md/commonCustomDatas/getLabelCustomData`,
    method: 'get'
  })
}

export function queryLabel(query) {
  return request({
    url: `/mes/sys/label/query`,
    method: 'post',
    data: query
  })
}

export function getLabel(id) {
  return request({
    url: `/mes/sys/label/getById/${id}`,
    method: 'get'
  })
}

export function removeLabel(data) {
  return request({
    url: `/mes/sys/label/delete`,
    method: 'delete',
    data: data
  })
}

export function saveLabel(data) {
  return request({
    url: `/mes/sys/label/save`,
    method: 'put',
    data: data
  })
}
// 预览
export function previewFile(params) {
  return request({
    url: `/mes/sys/label/preview?params=${params}`,
    method: 'get'
  })
}

// 用于规则配置页面
export function getLabelTemplate(id) {
  return request({
    url: `/me/itemRuleLabel/getLabelEntityParams/${id}`,
    method: 'get'
  })
}

export function queryFields(tableName) {
  return request({
    url: `/mes/sys/label/queryFields?tableName=${tableName}`,
    method: 'get'
  })
}
